package com.deng.dubbo.consumer;

import com.alibaba.dubbo.config.ConsumerConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author DengLibin
 * @Date 19-5-16
 * @Time 上午1:12
 * @Desc
 */
@Configuration
public class Config {
    /**
     * 消费者统一配置(所有的@Reference 都使用该配置)
     *
     * @return
     */
    @Bean
    public ConsumerConfig consumerConfig() {
        ConsumerConfig consumerConfig = new ConsumerConfig();
        consumerConfig.setCheck(true); //启动检查
        consumerConfig.setTimeout(20000);
        consumerConfig.setRetries(2);//重试次数(不包含第一次调用)
        return consumerConfig;
    }
}
